import { createSlice } from "@reduxjs/toolkit";

const initialState = [
  {
    id: 1,
    name: "张三",
    phone: "123456789",
    cart: "23232323232323",
  },
  {
    id: 2,
    name: "李四",
    phone: "123456789",
    cart: "23232323232323",
  },
  {
    id: 3, 
    name: "王五",
    phone: "123456789",
    cart: "23232323232323",
  },
];
const orderSlice = createSlice({
  name: "order",
  initialState,
  reducers: {
    setOrderInfo(state, action) {
      const { index, checked } = action.payload;
      state[index].status = checked;
    },
  },
});

export const { setOrderInfo } = orderSlice.actions;
export default orderSlice.reducer;